package com.redis.dynamicthreadpool.controller;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ThreadPoolExecutor;


@RestController
@RequestMapping
public class MyController {
    @Resource
    private ThreadPoolExecutor threadPoolExecutor;
    @RequestMapping("/pool")
    public String pool() {
        int core = threadPoolExecutor.getCorePoolSize();
        int max = threadPoolExecutor.getMaximumPoolSize();
        int currentQueueSize = threadPoolExecutor.getQueue().size();
        return core + "--" + max + "--" + currentQueueSize;
    }
}
